$(document).ready(function()
{

    $('#submit').click(function()
    {
        var policenumber = $('#policenumber').val();
        var password = $('#password').val();
        if (!policenumber){
            bootbox.alert('警号不能为空');
            return false;
        }
        if (!password){
            bootbox.alert('密码不能为空');
            return false;
        }
        loginURL = createLink('user', 'checklogin');
        $.ajax(
            {
                contentType: 'application/x-www-form-urlencoded',
                type: "POST",
                data:"policenumber=" + $('#policenumber').val() + '&password=' + password,
                url:loginURL,
                dataType:'json',
                success:function(data)
                {
                    if(data.result == 'fail') return  bootbox.alert(data.message);
                    if(data.result == 'success') return location.href = createLink('process','index');
                },
                error:function(data){bootbox.alert('登录失败')}
            })
        return false;
    })

})
